<?php
/**
 * 游戏组列表
 *
 * @author xiemaomao@iwgame.com
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: GameGroup.php 1059 2011-11-18 09:26:15Z mmxie $
 */
class IG_View_Helper_GameGroup extends Zend_View_Helper_Abstract
{
    public function gameGroup($name, $value = null, $attrs = array(), $listsep = "<br>\n")
    {
        $attrs += array('method'  => 'formSelect',
                        'product' => null,
                        'area'    => null,
                        'value'   => 'name',
                        'title'   => 'title');
        $options = array();

        $groups = IG_Product::getInstance()->getProduct($attrs['product'])
                                          ->getArea($attrs['area'])
                                          ->getGroups();
        foreach ($groups as $group) {
            $options[$group->{$attrs['value']}] = $group->{$attrs['title']};
        }

        return $this->view->$attrs['method']($name, $value, null, $options, $listsep);
    }
}